package com.rsk.dao;


import java.io.Serializable;
import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.rsk.entity.SysUser;


@Repository
public interface SysUserRepository extends JpaRepository<SysUser, Long>,JpaSpecificationExecutor<SysUser>,Serializable {
	
	@SuppressWarnings("rawtypes")
	@Query(value = "select user_name, password from sys_users where user_name =?1", nativeQuery = true)
	public List<Map> login(String userName);
	
	@Modifying
	@Query(value = "update sys_users set status = ?3 where id =?1 and account =?2", nativeQuery = true)
	public int updateSysUserStatus(Long id, String account, Integer status);
	
	@Modifying
	@Query(value = "update sys_users set is_del = 1 where id =?1 and account =?2", nativeQuery = true)
	public int delSysUser(Long id, String account,Long operatorUser);

	@Modifying
	@Query(value = "update sys_users set status = ?3 where id =?1 and account =?2", nativeQuery = true)
	public int updateSysUse(String account,String passWord,String userName,Integer status,Long operatorUser);
	
}
 